
from fastapi import FastAPI
import uvicorn
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
origins = [
    "*"]
from controller.contest import router as router_contest 
from controller.homework import router as router_homework 
from controller.user import router as router_user 
from controller.others import router as router_others
from controller.homework_record import router as homework_record_router
from controller.contest_record import router as contest_record_router
 
app = FastAPI()
static = StaticFiles(directory="static", )
app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)
app.mount("/static", static, name="static")
app.include_router(router_contest)
app.include_router(router_homework)
app.include_router(router_user)
app.include_router(router_others)
app.include_router(homework_record_router)
app.include_router(contest_record_router)



if __name__ == "__main__":
    uvicorn.run("app:app",reload=True)


